<?php
    
foreach($this->vote_info as $thread_id=>$thread){
    if(count($thread) >= 1){
        foreach($thread as $phase_id=>$phase){
            global $total_vote_sms, $total_vote_web;
            $total_vote_sms = 0;
            $total_vote_web = 0;
            $vote_list = array();
            
            if($phase->vote_enable ==1 && isset($this->photoList[$phase->thid][$phase->pid]) 
                && is_array($this->photoList[$phase->thid][$phase->pid]) 
                && count($this->photoList[$phase->thid][$phase->pid])>0
                && $phase->vote_type == EVENT_PHOTO_VOTE){
                $vote_list = $this->photoList[$phase->thid][$phase->pid];
        
                foreach($vote_list as $imgObj){
                    
                    $total_vote_sms=$total_vote_sms + $imgObj->vote_sms_count;
                    $total_vote_web=$total_vote_web + $imgObj->vote_web_count;
                }
                reset($vote_list);
                // Sort array
                if(is_array($vote_list) && count($vote_list) > 0)
                    usort($vote_list, "double_vote_cmp");

                $photo_block_id = $thread_id."_".$phase_id;
                $photo_block_title = "Top 10 ".$phase->thread_name.($phase->phase_name != ""?" - ".$phase->phase_name:"");

?>
            <div id="topten" class="event-area">
                <div class="event-header-short">
                    <span class="value"><?=$photo_block_title?></span>
                </div>
                <div class="event-content-short">
                    <!--<span class="value"><?=$photo_block_title?></span>-->
                    <ol class="topten">
                        <?php 
                        for($i=0; $i<count($vote_list) && $i<10; $i++){
                            $voteObj = $vote_list[$i];
                        ?>
                        <li><a href="http://photo.tamtay.vn/photo/view/<?php echo $voteObj->aid?>"><?php echo $voteObj->album_name." (".$voteObj->t."%)"?></a></li>
                     <?php        
                        }
                    ?>
                  </ol>
                </div>
                <div class="viewmore">
                    <a target="_blank" href="/event/<?php echo $this->short_cut;?>/votedlist/<?php echo $thread_id;?>/<?php echo $phase_id;?>">
                        <!--<img alt="Xem thêm" src="<?=$this->spath;?>/images/btn-more1.jpg">-->
                        Xem thêm
                    </a>
                </div>
                <div class="clear"></div>
            </div>  
                    
<?php
                }
        } 
    } // End of If
}// End of for loop ?>